package com.mayuanfei.handler;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

/**
 * TODO 类描述
 *
 * @author 老马
 * @date 2023-04-04 16:04
 */
@ControllerAdvice
public class GlobalException3 {
    @ExceptionHandler(ArithmeticException.class)
    public ModelAndView handleArithmeticException() {
        ModelAndView mv =new ModelAndView();
        mv.setViewName("error1.jsp");
        return mv;
    }

    @ExceptionHandler(NullPointerException.class)
    public ModelAndView handleNullPointerException() {
        ModelAndView mv =new ModelAndView();
        mv.setViewName("error2.jsp");
        return mv;
    }
}